package main

import "fmt"

func main() {
	var scores [5]int16
	scores[0] = 95
	scores[1] = 91
	scores[2] = 39
	scores[3] = 60
	scores[4] = 21
	var sum int16 = 0
	for i := 0; i < len(scores); i++ {
		sum += scores[i]
	}
	fmt.Println(sum)

	fmt.Println(scores)
	fmt.Printf("arr的地址为：%p \n", &scores[0])
	fmt.Printf("arr的地址为：%p \n", &scores[1])
	fmt.Printf("arr的地址为：%p \n", &scores[2])

	fmt.Println("=========================================")
	TestFunction()
}
func TestFunction() {
	var scores [5]int
	for i := 0; i < len(scores); i++ {
		fmt.Printf("请录入第个%d学生的成绩\n", i+1)
		fmt.Scanln(&scores[i])
	}
	for i := 0; i < len(scores); i++ {
		fmt.Printf("第%d个学生的成绩为:%d \n", i+1, scores[i])
	}
	for key, value := range scores {
		fmt.Printf("第%d个学生的成绩为:%d \n", key+1, value)
	}

	fmt.Println("================================================")

}
